<?php
include_once("../modules/checkA.php");
include_once("../../config.php");
$plate=select_one_line_all_items($table_Prefix."plate","mid = 'employee'");
?>


<?
//用来判断当前系统属于什么板块
$system_part = $plate['mid'];
include_once("select_datas.php");
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php include_once(ROOT_PATH_.'/controlbase/modules/head.php'); ?>
</head>

<body>

<div id="topbar"><?php include ROOT_PATH_.'/controlbase/modules/topbar.php'; ?></div>

<div id="container" class="<? echo $system_part ?>">

    <div id="maincontent">

        <div id="sidebar">
            <?php include ROOT_PATH_.'/controlbase/modules/sidebar.php'; ?>
        </div>


<div id="content" class="layui-form">
<h1> 员工列表 </h1>







    <div class="select-box layui-form">
        <form action="detail-list.php" >

            <div class="layui-form-item">
                <label class="layui-form-label">关键词</label>
                <div class="layui-input-block">
                    <input type="text" name="select_keywords" placeholder="可搜索姓名，备注，身份证，电话" autocomplete="off" class="layui-input" value="<? echo $_REQUEST['select_keywords']?>" >
                </div>
            </div>






            <?
            $department_list=select_lines_all_items($table_Prefix."department","nid desc","","0");
            $department=select_one_line_all_items($table_Prefix."department","nid = '".$_REQUEST['select_departmentid']."'");
            ?>


            <div class="layui-form-item">
                <label class="layui-form-label">网点</label>
                <div class="layui-input-block">
                    <select name="select_departmentid" lay-verify="required" >


                        <?
                        if(($_REQUEST['select_departmentid']!='全部')&&(($_REQUEST['select_departmentid']!='')))
                        {echo "<option value='".$_REQUEST['select_departmentid']."'>".$department['name']."</option>";}
                        ?>


                        <option value="全部">全部</option>



                        <?for($i=0;$i<count($department_list);$i++){?>
                            <option value="<? echo $department_list[$i]['nid'] ?>"><? echo $department_list[$i]['name'];?></option>
                            <? ;} ?>
                    </select>
                </div>
            </div>







            <div class="layui-form-item">
                <label class="layui-form-label">入职时间</label>

                <div class="layui-input-block">
                    <input type="text" name="select_startday" placeholder="请输入开始时间" autocomplete="off" class="layui-input"  onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" style="float: left; width: 112px" value="<?if($_REQUEST['select_startday']){echo $_REQUEST['select_startday'] ;} ?>" >

                    <span style="float: left;margin: 0 4px; line-height: 30px;">-</span>


                    <input type="text" name="select_endday" placeholder="请输入结束时间" autocomplete="off" class="layui-input" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"  style="float: left; width:112px" value="<?if($_REQUEST['select_endday']){echo $_REQUEST['select_endday'] ;} ?>"  >


                    <input type="hidden" name="nav-itemed"  value="member" >


                </div>


            </div>


            <br class="clearfloat"/>


            <button class="layui-btn">查找</button>

<!--            <a class="layui-btn" href="export-member-list-by-search.php?nowpageid=--><?//echo $url_str?><!--" target="_blank">导出当前数据</a>-->
<!---->

            <br class="clearfloat"/>
        </form>

        <br class="clearfloat"/>
    </div>





<!-- 用$system_part .list_boxes来控制来到确认板块信息显示-->
<div class="list-box">

 <a href="detail-add.php" class="layui-btn" lay-submit lay-filter="formMemberAdd" >新增</a>

<div class="list-boxes">



<?php

if ($detailnum == 0) {
    echo "数据添加中";
}

?>




<table class="layui-table">
  <colgroup>
    <col width="60">
    <col width="100">
	<col >
	<col >
	<col >
	<col >
	<col >
	<col >
	<col >
	<col width="160">

    <col>
  </colgroup>
  <thead>
    <tr>
      <th>序号</th>
      <th>姓名</th>
      <th>工号</th>
      <th>工龄</th>
      <th>部门</th>
      <th>职位</th>
      <th>电话</th>
      <th>状态</th>
      <th>登陆权限</th>
      <th>操作</th>
    </tr>
  </thead>
  <tbody>


	<?php
	for ($i = 0; $i < $detailnum; $i++) {
    ?>
        <tr id="item<?echo $detail[$i]['nid']?>" >
      <td><?echo $i+1+$plate['page_list_num']*($nowpageid-1) ?></td>
      <td><?echo $detail[$i]['name']?></td>
        <td><?echo $detail[$i]['mid']?></td>

<?
//判断离职日期。如果没有离职日期，就取当前日期。
if($detail[$i]['leavedate']=="0000-00-00 00:00:00")
{
    $detail[$i]['leavedate']=date("Y-m-d");
}

$age=count_period($detail[$i]['applydate'],$detail[$i]['leavedate']);

?>
      <td><?echo $age[0]."年".$age[1]."月".$age[2]."天";?></td>
      <? $department=select_one_line_all_items($table_Prefix."department","nid = '".$detail[$i]['departmentid']."'")?>
	  <td><?echo $department['name']?></td>


	  <td><?echo $detail[$i]['position']?></td>
	  <td><?echo $detail[$i]['phone']?></td>
	  <td><?echo $detail[$i]['status']?></td>
	  <td><? if($detail[$i]['authority']=="是"){echo "是";}else{echo "否";}?></td>
	  <td>
  <a href="detail-edit.php?nav-itemed=<?echo $system_part?>&nid=<? echo $detail[$i]['nid']?>&nowpageid=<?echo $nowpageid?>" class="layui-btn layui-btn-primary layui-btn-small" >
    <i class="layui-icon">&#xe642;</i>
  </a>


  <a href="javascript:void(0)" onclick="delItem (<?php echo $detail[$i]['nid']?>)" class="delete layui-btn layui-btn-primary layui-btn-small" >删除 <i class="layui-icon">&#xe640;</i> </a>


<!---->
<!--	   <a href="detail-statistic.php?nav-itemed=--><?//echo $system_part?><!--&nid=--><?// echo $detail[$i]['nid']?><!--" class="layui-btn layui-btn-primary layui-btn-small">-->
<!--    统计-->
<!--  </a>-->

  </td>
    </tr>
  <?php

}
?>


  </tbody>
</table>






</div>



    <div class="list-box-function"
        <? if ($detailnum == 0) {
            echo "style" . "='display:none'";
        } ?>
        >

        <?php include 'page_numbers.php'; ?>

    </div>
</div>


<!--list-box end-->
</div>

<!--content端點01-->
</div>
<!--maincontent端點01-->
<br class="clearfloat"/>
</div>
<!--container端點01-->
</div>







<!--删除box-->
<?php include '../modules/deletebar.php'; ?>
<!--删除box end-->

<?php include_once('../modules/footer.php'); ?> </body>
</html>
